package com.cjg.javaBasics;

import java.util.Arrays;

public class maoPao {
    public static void main(String[] args) {

        int[] c ={1,2,54,5,45,5,6,5};
        System.out.println(Arrays.toString(f(c)));
    }
    public static int[] f(int [] a){
        //比较几轮
        for (int i = 0; i <a.length-1 ; i++) {
            //临时变量
            int t =0;
            //每轮比较几次
            for (int j = 0; j <a.length-1-i ; j++) {
                if (a[j]>a[j+1]){
                    t=a[j];
                    a[j]=a[j+1];
                    a[j+1]=t;
                }
            }
        }
        return a;
    }
}
